package util

import (
	"database/sql"
	"strconv"
)

func GetNullInt64(int64 int64, null int64) sql.NullInt64 {
	if int64 == null {
		return sql.NullInt64{Int64: int64, Valid: false}
	} else {
		return sql.NullInt64{Int64: int64, Valid: true}
	}
}

func TransIntToTime(value int64) (result string) {
	if value < 60 {
		result += "0′"
		if value < 10 {
			result += "0"
		}
		result += strconv.FormatInt(value, 10)
	} else {
		result += strconv.FormatInt(value/60, 10) + "′"
		if value%60 < 10 {
			result += "0"
		}
		result += strconv.FormatInt(value%60, 10)
	}
	return
}
